 /*
    *  Copyright 2004 Thevert Liu  <thevert.liu@gmail.com>
    *
    *  Licensed under the Apache License, Version 2.0 (the "License");
    *  you may not use this file except in compliance with the License.
    *  You may obtain a copy of the License at
    *
    *      http://www.apache.org/licenses/LICENSE-2.0
    *
   *  Unless required by applicable law or agreed to in writing, software
  *  distributed under the License is distributed on an "AS IS" BASIS,
   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   *  See the License for the specific language governing permissions and
   *  limitations under the License.
   */
#ifndef X2_LIBXML2READER_H
#define X2_LIBXML2READER_H

#include <XMLReader.h>
#include <libxml/xmlreader.h>
#include <libxml/encoding.h>

class LibXML2Reader : public IXMLReader
{
public:
    LibXML2Reader(XMLContext * ctx=NULL) ;
    virtual ~LibXML2Reader() ;
    
    bool create(const std::string& xmlbody, const std::string& roottag) ;
	bool getAttribute(const std::string& name, std::string& val) const  ;
	bool getAttributeNS(const std::string& prefix, const std::string& name, std::string& val) const {return true;} ;
    bool getExpandData(std::string& val) const ;
    bool getValue   (std::string& val) const ;
    bool nextElement(std::string& name) const ;
    int  getTreeStartDepth() const ;
    bool getParentName(std::string& name) const ;
    bool isValue  () const ;
    bool isElement() const ;
    bool getNSName(std::string& ns, std::string& name)  ;

private:
    xmlTextReaderPtr mReader ;
    bool mNeedRead ;
    
} ;


#endif //X2_LIBXML2READER_H


